/* eslint-disable class-methods-use-this */
import _axios, { get, put, _delete } from '@/lin/plugin/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class wmsuser {
  // constructor() {}
  async createWmsUser(data) {
    return _axios({
      method: 'post',
      url: 'v1/wms-oms-user-rel',
      data,
    })
  }

  async getWmsUserList(page = 0, count = 10) {
    const res = await get(`v1/wms-oms-user-rel/page`,{
      page,
      count,
    })
    return res
  }

  async deleteWmsUser(id) {
    const res = await _delete(`v1/wms-oms-user-rel/${id}`)
    return res
  }

  async deleteWmsUserID(id) {
    const res = await get(`v1/user-oms/${id}`)
    return res
  }

  async gitUserHave() {
    const res = await get(`v1/userware`)
    return res
  }

  async gitWarehouse(id) {
    const res = await get(`v1/oms-userware/${id}`)
    return res
  }

  async editWmsUser(id, info) {
    const res = await put(`v1/wms-oms-user-rel/${id}`, info)
    return res
  }

  async editWmsUserPass(id, info) {
    const res = await put(`v1/wms-oms-user-rel/${id}/password`, info)
    return res
  }

  async editWarehouseBinding(info) {
    const res = await put(`v1/oms-userware`, info)
    return res
  }
  
  // 类中的方法可以代表一个用户行为
}

export default new wmsuser()
